package org.rency.crawler.fetch.converter.impl;

import org.rency.crawler.dal.entity.FetchStateDO;
import org.rency.crawler.domain.state.FetchStateDomain;
import org.rency.crawler.fetch.converter.AbstractDomainConvertor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;

/**
 * 描述: ${TODO}<br>
 * 最近修改时间:2017/11/20 18:05<br>
 *
 * @author CaiyuRen
 * @version V1.0
 * @since 2017/11/20 18:05
 */
@Component
public class FetchStateDomainConvertor extends AbstractDomainConvertor<FetchStateDomain, FetchStateDO> {

  @Override
  public FetchStateDomain convertDomain(FetchStateDO entity) {
    if(entity == null){
      return null;
    }
    FetchStateDomain domain = new FetchStateDomain();
    BeanUtils.copyProperties(entity,domain);
    return domain;
  }

  @Override
  public FetchStateDO convertEntity(FetchStateDomain domain) {
    if(domain == null){
      return null;
    }
    FetchStateDO entity = new FetchStateDO();
    BeanUtils.copyProperties(domain,entity);
    return entity;
  }
}
